<template>
	<view class="my-page">
		<view class="header">
			<image class="logo" src="/static/h5img/top_logos@2x.png"></image>
			<!-- <view>
				<image class="notice-header" src="../../static/h5img/notice_header@2x.png"></image>
			</view> -->
		</view>
		<!-- 轮播图 -->
		<view class="page-section-spacing">
			<swiper class="swiper" indicator-dots="true" autoplay="true" interval="3000" duration="500">
				<swiper-item><view class="swiper-item uni-bg-red">A</view></swiper-item>
				<swiper-item><view class="swiper-item uni-bg-green">B</view></swiper-item>
				<swiper-item><view class="swiper-item uni-bg-blue">C</view></swiper-item>
			</swiper>
			<!-- 消息通知 -->
			<!-- <view class="msg-tip">
				<view class="tip-content">
					<image class="notice" src="/static/h5img/notice_icon@2x.png"></image>
					<text class="tip-text">疫情原因影响发货消息通知，望周知</text>
				</view>
				<image class="jump-arrow" src="/static/h5img/arrow_right@2x.png" @tap="tipJump"></image>
			</view> -->
			<!-- 我的模块 -->
			<view class="category">
				<view class="cate-item" v-for="(item, index) in cateArr" :key="`cate-${index}`" @tap="linkto(item.url)">
					<view class="cate-img-box"><image class="cate-img" :src="item.src"></image></view>
					<text class="cate-text">{{ item.text }}</text>
				</view>
			</view>
			<!-- 可跳转三部分 -->
			<view class="detail-block">
				<view class="detail-item" v-for="(item, index) in detailArr" :key="`detail-${index}`" @tap="linkto(item.url)">
					<image class="detail-img" :src="item.src"></image>
					<text class="detail-text">{{ item.text }}</text>
				</view>
			</view>
			<view class="img-outer"><image src="" class="link-img"></image></view>
		</view>
	</view>
</template>

<script>
import api from '@/common/api';
import { ifLogin } from '@/common/js/index'
export default {
	data() {
		return {
			token: '',
			cateArr: [
				{ text: '活动报名', src: '/static/h5img/hdbm@2x.png', url: '/pages/activityRegistration/activityRegistration' },
				{ text: '排行榜', src: '/static/h5img/phb@2x.png', url: '/pages/rankingList/rankingList' },
				{ text: '高级订货', src: '/static/h5img/gjdh@2x.png', url: '/pages/advancedOrder/advancedOrder' },
				{ text: '我的授权', src: '/static/h5img/wdsq@2x.png', url: '/pages/authorization/authorization' }
			],
			detailArr: [
				{ text: '资金明细', src: '/static/h5img/zjmx@2x.png', url: '/pages/datail/datail' },
				{ text: '粉丝详情', src: '/static/h5img/fsxq@2x.png', url: '/pages/myFans/myFans' },
				{ text: '团队业绩', src: '/static/h5img/tdyj@2x.png', url: '/pages/achievememt/achievememt' }
			]
		};
	},
	methods: {
		// 点击提示信息跳转详情
		tipJump() {
			console.log('jump');
		},
		// 点击跳转到链接页面
		linkto(url) {
			console.log(url);
			if (url) {
				uni.navigateTo({
					url: url
				});
			} else {
				uni.showToast({
					title: '开发中...',
					icon: 'none'
				});
			}
		},
		// 获取swipper图片信息
		getSwipper() {
			this.token = uni.getStorageSync('token');
			// const [err,res] = await api.authorize({
			// 	// method:'get',
			// 	header:{
			// 		'Content-Type': 'application/json;charset=UTF-8',
			// 		'token': this.token
			// 	}
			// })
		}
	},
	onLoad() {
		const status = ifLogin()
		if (status) {
			this.getSwipper();
		}
	}
};
</script>

<style scoped lang="scss">
body,
uni-page-body {
	background-color: #f7f7f7;
	height: 100%;
}
.my-page {
	background-image: url('../../static/h5img/czt_bg@2x.png');
	background-size: auto 420rpx;
	background-repeat: no-repeat;
	min-height: 420rpx;
	background-color: #f7f7f7;
	height: 100%;
	overflow: auto;
}
.header {
	z-index: 10;
	display: flex;
	position: absolute;
	// background-color: #2e2525;
	justify-content: space-between;
	height: 80rpx;
	width: 100%;
	.notice-header {
		width: 40rpx;
		height: 60rpx;
		margin: 10rpx 30rpx 0 0;
	}
	.logo {
		width: 134rpx;
		height: 40rpx;
		margin: 20rpx 0 0 20rpx;
	}
}
.page-section-spacing {
	padding: 10rpx 30rpx 0 30rpx;
	box-sizing: border-box;
	height: 100%;
	&::before {
		height: 44px;
		content: '';
		display: block;
	}
	uni-swiper {
		height: 422rpx;
	}
	.swiper-item {
		border-radius: 24rpx;
		height: 100%;
	}
	.msg-tip {
		height: 70rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-top: 28rpx;
		background-color: #fff;
		border-radius: 12rpx;
		.tip-content {
			display: flex;
			align-items: center;
		}
		.notice {
			width: 34rpx;
			height: 25rpx;
			margin: 0 22rpx 0 30rpx;
		}
		.jump-arrow {
			height: 22rpx;
			width: 12rpx;
			margin-right: 22rpx;
		}
		.tip-text {
			font-size: 22rpx;
			color: #333333;
		}
	}
	.category {
		height: 224rpx;
		margin-top: 20rpx;
		display: flex;
		align-items: center;
		background-color: #ffffff;
		border-radius: 12rpx;
		.cate-item {
			width: 25%;
			text-align: center;
			.cate-text {
				font-family: PingFang-SC-Medium;
				font-size: 28rpx;
				color: #333333;
			}
			.cate-img-box {
				width: 100rpx;
				height: 100rpx;
				margin: 0 auto;
				.cate-img {
					height: 100%;
					width: 100%;
				}
			}
		}
	}
	.detail-block {
		margin-top: 20rpx;
		margin-right: -20rpx;
		display: flex;
		.detail-item {
			width: 33.3%;
			margin-right: 20rpx;
			height: 90rpx;
			.detail-img {
				width: 100%;
				height: 90rpx;
			}
			.detail-text {
				position: relative;
				top: -84rpx;
				left: 20rpx;
				color: #ffffff;
				font-size: 26rpx;
			}
		}
	}
	.img-outer {
		margin-top: 22rpx;
		.link-img {
			height: 280rpx;
			width: 100%;
			background-color: #eaf;
			border-radius: 12rpx;
		}
	}
}
</style>
